<me:UIVKKOPF x:Class="WPFExcelReport.TVKKOPF"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"  
                    xmlns:KD="clr-namespace:WPFExcelReport;assembly=TKDSTAMM"  
                    xmlns:KA="clr-namespace:WPFExcelReport;assembly=TKDANSP"  
                    xmlns:HR="clr-namespace:WPFExcelReport;assembly=THRSTAMM"  
                    xmlns:VL="clr-namespace:WPFExcelReport;assembly=TVERSART"  
                    xmlns:ZA="clr-namespace:WPFExcelReport;assembly=TZABED"  
                    xmlns:ZB="clr-namespace:WPFExcelReport;assembly=TVKZUAB"  
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                    xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR" 
                    xmlns:VKP="clr-namespace:WPFExcelReport;assembly=TVKPOS"   
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    Background="White"  
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIVKKOPF.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>     
        <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:M2YD x:Key="M2YD"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIVKKOPF.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0"  >
            <WrapPanel    VerticalAlignment="Top">
                <Grid Margin="10,0,0,0"  VerticalAlignment="Top"
                      >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24"
                         >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                 </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top"
                      >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button  Click="EditCommand" Width="24" Height="20">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0"  VerticalAlignment="Top" 
                      >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button  Grid.Column="0"   Click="ManageCommand" Width="12" Height="20"  >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Extend.png" />
                        </Button.Background>
                    </Button>
                 </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top" 
                      Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource ResourceKey=bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top"
                      Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource ResourceKey=bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top" 
                      Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0"  VerticalAlignment="Top" 
                      >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions> 
                    <KD:TSKD02 Grid.Column="1" MinWidth="100" 
                              KEY="{Binding Path=KUNDNR,ElementName=TV}"  Width="150" />
                </Grid> 
                <Grid Margin="10,0,0,0" VerticalAlignment="Top"  >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock FontSize="16"  Text="{Binding Source={Localization:Translate Word=订单号}}"/>
                    <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="2" PRE="  "   IsAutoClear="True" CharacterCasing="Upper" 
                              Text="{Binding KRS,ElementName=TV}" Width="30" />
                    <ex:TXT72 Grid.Column="2" FontSize="16" Margin="5,0,0,0" MaxLength="6"  IsAutoClear="True" PRE="000000" 
                              Text="{Binding LFD,ElementName=TV}" KeyUp="AUF_Enter" Width="90" />
                </Grid>
                <Grid Margin="10,0,0,0"  VerticalAlignment="Top" Visibility="{Binding IsVV,Converter={StaticResource bv}}" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" FontSize="16"  >发货单</TextBlock>
                    <ex:TXT72 MaxLength="8" PRE="00000000" Grid.Column="1"  FontSize="18"  Text="{Binding LIEFSCH,ElementName=TV}" Width="120"/>
                </Grid>
                <Grid Margin="10,0,0,0"  VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0"  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Grid.Column="2" FontSize="16" Text="{Binding Source={Localization:Translate Word=查询}}"/>
                </Grid>
                <Grid Margin="10,0,0,0"  VerticalAlignment="Top" Visibility="{Binding IsOrder,ElementName=TV,Converter={StaticResource ResourceKey=bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0"  Click="LinkedOrderCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/link.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Grid.Column="2" FontSize="16" Text="{Binding Source={Localization:Translate Word=管理采购}}"/>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top"  >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <DR:TDRAUFTR  Grid.Column="0" Name="cDR" DocType="{Binding PRTYPE,ElementName=TV}" PrintType="OpenExcel" />
                    <Button  Grid.Column="1"   Click="btnPrint_Click" Height="20" Margin="5,0,0,0" Width="Auto" Content="{Binding Source={Localization:Translate Word=打印确认函}}" />
                </Grid>
             </WrapPanel>
            <WrapPanel IsEnabled="{Binding IsKEY,ElementName=TV}" 
                       > 
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" FontSize="16"  Text="{Binding Source={Localization:Translate Word=负责人:}}"></TextBlock>
                    <HR:THR20 Grid.Column="1" 
                              BENID="{Binding Path=SACHBE,ElementName=TV}"
                              Width="150"/>
                </Grid> 
                <WrapPanel>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=数量}}"   FontSize="18"/>

                    <WrapPanel>

                        <TextBlock Text="{Binding VKKGESMENGE2}" FontSize="18"  Width="120" ></TextBlock>
                        <TextBlock Text="{Binding Source={Localization:Translate Word=M}}"/>
                        <TextBlock  FontSize="18"  Width="120" 
                                    Text="{Binding VKKGESMENGE2,Converter={StaticResource M2YD}}"/>
                        <TextBlock Text="{Binding Source={Localization:Translate Word=YD}}"/>
                    </WrapPanel>
                </WrapPanel>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" FontSize="18" Text="{Binding Source={Localization:Translate Word=金额}}" ></TextBlock>
                    <TextBlock Grid.Column="1" Text="{Binding VKKGESWERT,Source={StaticResource vwMaster}}" FontSize="18" Width="80" ></TextBlock>
                </Grid>  
            </WrapPanel>
            <WrapPanel Name="ZoneExt"> 
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0"  FontSize="16"  Text="{Binding Source={Localization:Translate Word=采购单号}}" ></TextBlock>
                    <ex:TXT72 MaxLength="10" Grid.Column="1" Text="{Binding VKKBESTNR,Source={StaticResource vwMaster},Converter={StaticResource gb2312}}"  Width="100" />
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition> 
                    </Grid.ColumnDefinitions> 
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=联系人:}}"></TextBlock>
                    <TextBlock Grid.Column="1" Text="{Binding VKKBESTNR,Source={StaticResource vwMaster},
                        Converter={StaticResource gb2312}}"  Width="100" />
                    <KA:TSKD14  Grid.Column="2"  KUNDNR="{Binding KUNDNR,ElementName=TV}" 
                                KEY="{Binding VKKANSPRECH,ElementName=TV}" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}"/>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=运输方式:}}"></TextBlock>
                    <TextBlock   Grid.Column="1" Text="{Binding VKKVERSART,Source={StaticResource vwMaster},Converter={StaticResource gb2312}}"  Width="60" />
                    <TextBlock   Grid.Column="2" Text="{Binding Source={Localization:Translate Word=承运人:}}"></TextBlock>
                    <TextBlock   Grid.Column="3" Text="{Binding VKKSPED,Source={StaticResource vwMaster},Converter={StaticResource gb2312}}"  Width="60" />
                    <VL:TSVL02  Grid.Column="4" SART="{Binding SART,ElementName=TV}" 
                                KEY="{Binding VSPED,ElementName=TV}" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}"/>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=发货条件:}}"></TextBlock>
                    <TextBlock Grid.Column="1" Text="{Binding VKKLIEFBED,Source={StaticResource vwMaster},Converter={StaticResource gb2312}}"  Width="100" />
                    <SD:TSSD0241 Grid.Column="2"  KEY="{Binding LIEFBED,ElementName=TV}" 
                                 Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}"/>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=付款方式:}}"></TextBlock>
                    <ZA:TSZA02 Grid.Column="1"  KEY="{Binding ZAHLBED,ElementName=TV}"
                               IsEdit="True" 
                                Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}"/>
                </Grid> 
            </WrapPanel>            
         
        </StackPanel> 
    </Grid>
</me:UIVKKOPF>
